<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="app">
        <h3>银行账户余额变更通知</h3>
        <p>账户：468546494+</p>
        <p> 余额：{{count}} </p>
        支取人民币：<input type="text" v-model="money"/>&nbsp;&nbsp;<!-- 修正v-odel为v-model -->
        <button type="button" @click="changeMoney()">支取{{money}}元</button>
        <p>支取后余额为：{{count}}元</p>
        <h3>支取明细</h3>
        {{detail}}<!-- 调用计算属性时不需要加括号 -->
        <hr>
    </div>
</body>
<script type="text/javascript">
    const appCom = {
        data(){
            return {
                count: 100000,
                // 移除错误的类型定义 (property) record: never[]
                record: [],
                money: '' // 补充money的初始值
            }
        },
        watch:{
            count(newValue, oldValue){
                alert('账户余额从：' + oldValue + '变为' + newValue + '元！');// 修正alter为alert
            }
        },
        methods:{
            changeMoney(){
                // 将输入的字符串转为数字
                const moneyNum = Number(this.money);
                if(isNaN(moneyNum) || moneyNum <= 0){
                    alert('请输入正确取款金额!');
                    return;
                }
                if(moneyNum > this.count){
                    alert('余额不足，请重新输入取款金额!');
                    return;
                }
                // 余额减少
                this.count = this.count - moneyNum;
                // 记录取款金额
                this.record.push(moneyNum);
                // 清空输入框
                this.money = '';
            }
        },
        computed:{// 修正computer为computed
            detail() {
                let str = '';
                for(let i = 0; i < this.record.length; i++){
                    str = str + '第' + (i + 1) + '次取款：' + this.record[i] + '元；';
                }
                return str;
            }
        }
    };
    // 修正变量名和组件名 Contapp->app，comApp->appCom
    const app = Vue.createApp(appCom).mount("#app");
</script>
</html>